package com.aust.openbrowsers;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    Button btnLogin;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btnLogin=findViewById(R.id.btnLogin);
        btnLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent();
                intent.setClass(MainActivity.this,SecondActivity.class);
//                intent.putExtra("name","Hello SecondActivity");
//                intent.putExtra("sex","man");
                Bundle bundle =new Bundle();
                bundle.putString("name","Hello SecondActivity");
                bundle.putString("sex","woman");
                intent.putExtras(bundle);
                //设置动作为android.intent.action.VIEW
//                intent.setAction("android.intent.action.VIEW");
//                //设置要打开的网址
//                intent.setData(Uri.parse("http://www.baidu.com"));
                startActivity(intent);
            }
        });
    }
}